package diary.leetcode.is_unqiue_lcci;

public class Solution1 {

    public boolean isUnique(String astr) {
        if (astr.length() <= 1) {
            return true;
        }

        if (astr.length() > 128) {
            return false;
        }

        boolean[] charset = new boolean[128];
        for (int i = 0; i < astr.length(); i++) {
            int val = astr.charAt(i);
            if (charset[val]) {
                return false;
            }
            charset[val] = true;
        }

        return true;
    }

}
